package com.example.lin.day9_27.activity;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;

import com.example.lin.day9_27.mvp.presenter.IShopPresenter;
import com.example.lin.day9_27.mvp.presenter.ShopPresenter;
import com.example.lin.day9_27.mvp.view.IShopView;

import java.util.List;

public class ShopActivity extends AppCompatActivity implements IShopView {

    //View 持有 Presenter 的引用
    private IShopPresenter shopPresenter;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(null);
        shopPresenter = new ShopPresenter(this);
    }

    /**
     * 模拟点击事件,点击之后 告诉 Presenter 需要获取 商品列表
     * @param view
     */
    public void loadShopList(View view){
        shopPresenter.getShopList(1,20);
    }


    /**
     * 接收 Presenter 传递过来的 商品列表
     * @param list
     */
    @Override
    public void updateShopList(List<String> list) {
        //刷新适配器,得到 List 之后传递给适配器,做UI更新
    }
}
